package main

import "fmt"

func main() {
	//带有缓冲的channel
	c := make(chan int, 3)
	fmt.Println(len(c), cap(c))

	go func() {
		defer fmt.Println("子go  end")
		for i := 0; i < 5; i++ {
			c <- i
			fmt.Println("子 go 发送的元素:", i)
		}
	}()

	for i := 0; i < 5; i++ {
		fmt.Println(<-c)
	}

}
